package com.wiscamp.ninechapters.problems.infrastructure.po.problems;

import com.wiscamp.ninechapters.ddd.PersistenceObject;
import com.wiscamp.ninechapters.problems.enums.Actions;
import jakarta.persistence.*;
import lombok.Data;

import java.io.Serial;

/**
 * 问题解析
 */
@Data
@Entity
@Table(name = "question_solutions")
public class QuestionSolutionPO implements PersistenceObject {
    @Serial
    private static final long serialVersionUID = 8408234682411791222L;

    /**
     * 解析编号
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "solution_id", insertable = false, nullable = false)
    private long solutionId = 0;

    /**
     * 题编号
     */
    @Column(name = "problem_id", nullable = false)
    private long problemId = 0;

    /**
     * 问题编号
     */
    @Column(name = "question_id", nullable = false)
    private long questionId = 0;

    /**
     * 解析超文本内容
     */
    @Column(name = "solution_hypertext")
    private String solutionHypertext = "";

    /**
     * 问题解析序号
     */
    @Column(name = "solution_index")
    private int solutionIndex = 0;

    /**
     * 是否优选解题思路
     */
    @Column(name = "preferred")
    private boolean preferred = false;

    /**
     * 操作：CREATE / UPDATE / DELETE
     */
    @Transient
    private Actions action = Actions.NONE;
}